home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PVDRIVER / DVIWN281.ZIP / GENALL2.CMD < prev    next >
OS/2 REXX Batch file  |  1993-09-30  |  2KB  |  74 lines

  1. /*
  2.  * This file generates multiple fonts in a single pass; after all fonts have
  3.  * been generated, it notifies dviwin to re-read all fonts. This feature
  4.  * (the notification of dviwin) has only been tested in seamless mode; you
  5.  * will probably need to make some modifications. Many thanks to Darrel
  6.  * Hankerson for the REXX techniques.
  7.  */
  8. CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  9. CALL SysLoadFuncs
  10.  
  11. temp_ = value('TEMP',,'OS2ENVIRONMENT')
  12. IF temp_ = '' THEN temp_ = value('TMP',,'OS2ENVIRONMENT')
  13. temp_ = translate(temp_, '\', '/')
  14.  
  15. lock_ = temp_'\lock_$_$.cmd'
  16. IF stream(lock_,'c','query exists') <> '' THEN
  17.   DO
  18.    say ''
  19.    say 'It seems that another instance of this batch file is already running.'
  20.    say 'If this is true, please wait until it finishes and then run this batch'
  21.    say 'file again. If on the other hand this is not true, delete the file'
  22.    say lock_ ' and then run this batch file again.'
  23.    SIGNAL ERROR_EXIT
  24.   END
  25. rc = lineout(lock_, '@echo off')
  26. DO WHILE lines(ARG(1))
  27.   rc = lineout(lock_, linein(ARG(1)))
  28. END
  29. rc = stream(ARG(1), 'c', 'close')
  30. rc = stream(lock_, 'c', 'close')
  31. CALL SysFileDelete(ARG(1))
  32. IF stream(temp_'\error$_$','c','query exists') <> '' THEN
  33.    CALL SysFileDelete(temp_'\error$_$')
  34. 'cmd /c'temp_'\lock_$_$.cmd'
  35. CALL SysFileDelete(temp_'\lock_$_$.cmd')
  36.  
  37. /*
  38.  * Notify dviwin to re-read the fonts. This is done by calling it with
  39.  * the "-r" command line switch. If you normally start dviwin with the
  40.  * "-1" command line switch, then you need to include that switch here
  41.  * as well.
  42.  *
  43.  * First we need to test for the existence of the file temp_\error$_$.
  44.  * If it exists, then an error has occured in genpk2.cmd and we should
  45.  * not call dviwin.
  46.  */
  47. IF stream(temp_'\error$_$','c','query exists') <> '' THEN
  48.   CALL SysFileDelete(temp_'\error$_$')
  49. ELSE
  50.   DO
  51.     classname = 'WPProgram'
  52.     title = 'dviwin -r'
  53.     location = '<WP_DESKTOP>'
  54.     ObjectID = '<dviwin_reset>'
  55.     setup='OBJECTID=' || ObjectID || ';EXENAME=dviwin.exe;'||,
  56.           'PARAMETERS=-r;OPEN=DEFAULT'
  57.     IF SysCreateObject(classname,title,location,setup,'replace') = 0 THEN
  58.       DO
  59.         say 'SysCreateObject failed'
  60.         SIGNAL ERROR_EXIT
  61.       END
  62.     ELSE IF SysDestroyObject(ObjectID) = 0 THEN
  63.       DO
  64.         say 'SysDestroyObject failed'
  65.         SIGNAL ERROR_EXIT
  66.       END
  67.   END
  68. EXIT
  69.  
  70. ERROR_EXIT:    say ''
  71.         say "Press Enter to continue..."
  72.         pull junk_
  73.         EXIT
  74.